package com.cdks.wuxiu.api.component.constant;

/**
 * 认证等级常量
 */
public enum AuthLevelEnum {
    AUTH_LEVEL_NONE(0, "未认证"),
    AUTH_LEVEL_STUDY(1, "见习"),
    AUTH_LEVEL_BRASS(2, "铜牌"),
    AUTH_LEVEL_SILVER(3, "银牌"),
    AUTH_LEVEL_GOLD(5, "金牌");

    private final Integer code;
    private final String desc;

    AuthLevelEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static String getDescByCode(Integer code) {
        for (AuthLevelEnum level : AuthLevelEnum.values()) {
            if (level.getCode().equals(code)) {
                return level.getDesc();
            }
        }
        return null; // 或者返回一个默认值，如 "未知"
    }
    
    // 可选：添加根据code获取枚举实例的方法
    public static AuthLevelEnum getByCode(Integer code) {
        for (AuthLevelEnum level : AuthLevelEnum.values()) {
            if (level.getCode().equals(code)) {
                return level;
            }
        }
        return null;
    }
}
